package com.example.demo1.service;

import com.example.demo1.Entity.BanInformation;
import com.example.demo1.repository.BanInformationRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class BanInformationServiceImpl implements BanInformationService {

        @Autowired
        private BanInformationRepository banInformationRepository;

        @Transactional
        @Override
        public BanInformation BanInformationeSet(String college,
                                                 String banname

        ) {

            // 创建实体对象
            BanInformation banInformation = new BanInformation();
            banInformation.setCollege(college);
            banInformation.setBanname(banname);


            return banInformation;
        }
        @Transactional
       // @Override
        public void save_data(BanInformation B) {
            banInformationRepository.save(B);
            System.out.println("插入成功！ID: " + B.getId());
        }
    }


